﻿using System;
using Amba.KeyValueStorage.Models;
using Orchard.Data.Migration;

namespace Amba.KeyValueStorage
{
    public class Migrations : DataMigrationImpl
    {
        public int Create()
        {
            SchemaBuilder.CreateTable(typeof(KeyValueRecord).Name,
                table => table
                    .Column<long>("Id", c => c.PrimaryKey().Identity())
                    .Column<string>("DataKey", c => { c.WithLength(100).Unique().NotNull(); })
                    .Column<DateTime>("LastUpdate")
                    .Column<string>("Value", c => c.Unlimited())
                );
            return 1;
        }
    }
}